/**
 * shop模块接口列表
 */

import base from './base'; // 导入接口域名列表
import axios from '@/utils/http'; // 导入http中创建的axios实例
import qs from 'qs'; // 根据需求是否导入qs模块

const shop = {
    addCategory(params: any) {
        return axios.post(`${base.shop}/addCategory`, qs.stringify(params));
    },
    getCategoryList() {
        return axios.post(`${base.shop}/getCategoryList`);
    },
    getAllCategoryList() {
        return axios.post(`${base.shop}/getAllCategoryList`);
    },
    addAttributeKey(params: any) {
        return axios.post(`${base.shop}/addAttributeKey`, qs.stringify(params));
    },
    getAttributeKey(params: any){
        return axios.post(`${base.shop}/getAttributeKey`, qs.stringify(params));
    },
    getSpecVoByCategoryId(params: any){
        return axios.post(`${base.shop}/getSpecVoByCategoryId`, qs.stringify(params));
    },
    addSpecKey(params: any){
        return axios.post(`${base.shop}/addSpecKey`, qs.stringify(params));
    },
    addSpecOptions(params: any){
        return axios.post(`${base.shop}/addSpecOptions`, qs.stringify(params));
    },
    getSpecOptionsByKeyId(params: any){
        return axios.post(`${base.shop}/getSpecOptionsByKeyId`, qs.stringify(params));
    },
    deleteSpecOptionById(params: any){
        return axios.delete(`${base.shop}/deleteSpecOptionById/${params}`);
    },
    deleteSpecKeyById(params: any){
        return axios.delete(`${base.shop}/deleteSpecKeyById/${params}`);
    },
    deleteAttributeKeyById(params: any){
        return axios.delete(`${base.shop}/deleteAttributeKeyById/${params}`);
    },
    uploadSkuPicture(params: any){
        return axios.post(`${base.shop}/uploadSkuPicture`,params);
    },
    addSpuSku(params: any){
        const config = {
            headers: {
              'Content-Type': 'application/json',
            }
          };
        
          return axios.post(`${base.shop}/addSpuSku`, params, config);
    },
    getAttrKeyOptionsById(params: any){
        return axios.get(`${base.shop}/getAttrKeyOptionsById/${params}`);
    },
    deleteAttrKeyOptionByIndex(params: any){
        return axios.post(`${base.shop}/deleteAttrKeyOptionByIndex`, qs.stringify(params));
    },
    getSpuList(params: any){
        return axios.post(`${base.shop}/getSpuList`, qs.stringify(params));
    },
    getSkuBySpuId(params: any){
        return axios.get(`${base.shop}/getSkuBySpuId/${params}`);
    },
    getSpuById(params: any){
        return axios.get(`${base.shop}/getSpuById/${params}`);
    },
    getSpecOptionsBySpuId(params: any){
        return axios.get(`${base.shop}/getSpecOptionsBySpuId/${params}`);
    },
    editCategory(params: any){
        return axios.post(`${base.shop}/editCategory`,params);
    },
    disableCategoryById(params: any){
        return axios.post(`${base.shop}/disableCategoryById`,params);
    },
    enableCategoryById(params: any){
        return axios.post(`${base.shop}/enableCategoryById`,params);
    },
    deleteSpuById(params: any){
        return axios.post(`${base.shop}/deleteSpuById`,params);
    },
    editSku(params: any){
        return axios.post(`${base.shop}/editSku`,params);
    },
    getAllSkuBySpuId(params: any){
        return axios.get(`${base.shop}/getAllSkuBySpuId/${params}`);
    },

}

export default shop;